#include <stdio.h>
#include "command.h"
#undef __COMMAND_H

command getCmd(char *line)
{
	command c = (command)malloc(sizeof(_command));
	char *t;
	int i = 0;
	*(strchr(line, ')')) = 0;

	char *lp = strchr(line, '(');
	c->name = (char *)malloc(lp-line);
	strncpy(c->name, line, lp-line);

	for (t = strtok(strchr(line, '(')+1, ","); t != NULL; t = strtok(NULL, ","))
	{
		printf("felix: debug: word %i: %s\n", i, t);
		c->arg[i] = (char *)malloc(strlen(t));
		strcpy(c->arg[i], t);
		i++;
	}

	return c;
}
